package com.service.impl;

import com.entity.User;
import com.mapper.UserMapper;
import com.service.UserService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Data
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> selectAllUsers() {
        return userMapper.selectAllUsers();
    }

    @Override
    public User selectOneUserById(int id) {
        return userMapper.selectOneUserById(id);
    }

    @Override
    public List<User> selectUsersByName(String name) {
        return userMapper.selectUsersByName(name);
    }

    @Override
    public int deleteOneUserById(int id) {
        return userMapper.deleteOneUserById(id);
    }

    @Override
    public int insertOneUserById(User user) {
        return userMapper.insertOneUserById(user);
    }

    @Override
    public int updateOneUserById(User user) {
        return userMapper.updateOneUserById(user);
    }
}
